/* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */
/* vim:set et sts=4: */
/* IBust - IBus with Traditional interface
 * Copyright(c) 2013 Daniel Sun
 * Copyright (C) 2008-2010 Peng Huang <shawn.p.huang@gmail.com>
 * Copyright (C) 2008-2010 Red Hat, Inc.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */

#if !defined (__IBUST_H_INSIDE__) && !defined (IBUST_COMPILATION)
#error "Only <ibust.h> can be included directly"
#endif

/**
 * SECTION: ibusttypes
 * @short_description: Generic types for  IBust.
 * @stability: Stable
 *
 * This section consists generic types for IBust, including shift/control key modifiers,
 * and a rectangle structure.
 */
#ifndef __IBUST_TYPES_H_
#define __IBUST_TYPES_H_

/**
 * IBustModifierType:
 * @IBUST_SHIFT_MASK: Shift  is activated.
 * @IBUST_LOCK_MASK: Cap Lock is locked.
 * @IBUST_CONTROL_MASK: Control key is activated.
 * @IBUST_MOD1_MASK: Modifier 1 (Usually Alt_L (0x40),  Alt_R (0x6c),  Meta_L (0xcd)) activated.
 * @IBUST_MOD2_MASK: Modifier 2 (Usually Num_Lock (0x4d)) activated.
 * @IBUST_MOD3_MASK: Modifier 3 activated.
 * @IBUST_MOD4_MASK: Modifier 4 (Usually Super_L (0xce),  Hyper_L (0xcf)) activated.
 * @IBUST_MOD5_MASK: Modifier 5 (ISO_Level3_Shift (0x5c),  Mode_switch (0xcb)) activated.
 * @IBUST_BUTTON1_MASK: Mouse button 1 (left) is activated.
 * @IBUST_BUTTON2_MASK: Mouse button 2 (middle) is activated.
 * @IBUST_BUTTON3_MASK: Mouse button 3 (right) is activated.
 * @IBUST_BUTTON4_MASK: Mouse button 4 (scroll up) is activated.
 * @IBUST_BUTTON5_MASK: Mouse button 5 (scroll down) is activated.
 * @IBUST_HANDLED_MASK: Handled mask indicates the event has been handled by ibust.
 * @IBUST_FORWARD_MASK: Forward mask indicates the event has been forward from ibust.
 * @IBUST_IGNORED_MASK: It is an alias of IBUST_FORWARD_MASK.
 * @IBUST_SUPER_MASK: Super (Usually Win) key is activated.
 * @IBUST_HYPER_MASK: Hyper key is activated.
 * @IBUST_META_MASK: Meta key is activated.
 * @IBUST_RELEASE_MASK: Key is released.
 * @IBUST_MODIFIER_MASK: Modifier mask for the all the masks above.
 *
 * Handles key modifier such as control, shift and alt and release event.
 * Note that nits 15 - 25 are currently unused, while bit 29 is used internally.
 */
typedef enum
{
    IBUST_SHIFT_MASK    = 1 << 0,
    IBUST_LOCK_MASK     = 1 << 1,
    IBUST_CONTROL_MASK  = 1 << 2,
    IBUST_MOD1_MASK     = 1 << 3,
    IBUST_MOD2_MASK     = 1 << 4,
    IBUST_MOD3_MASK     = 1 << 5,
    IBUST_MOD4_MASK     = 1 << 6,
    IBUST_MOD5_MASK     = 1 << 7,
    IBUST_BUTTON1_MASK  = 1 << 8,
    IBUST_BUTTON2_MASK  = 1 << 9,
    IBUST_BUTTON3_MASK  = 1 << 10,
    IBUST_BUTTON4_MASK  = 1 << 11,
    IBUST_BUTTON5_MASK  = 1 << 12,

    /* The next few modifiers are used by XKB, so we skip to the end.
     * Bits 15 - 23 are currently unused. Bit 29 is used internally.
     */

    /* ibust mask */
    IBUST_HANDLED_MASK  = 1 << 24,
    IBUST_FORWARD_MASK  = 1 << 25,
    IBUST_IGNORED_MASK  = IBUST_FORWARD_MASK,

    IBUST_SUPER_MASK    = 1 << 26,
    IBUST_HYPER_MASK    = 1 << 27,
    IBUST_META_MASK     = 1 << 28,

    IBUST_RELEASE_MASK  = 1 << 30,

    IBUST_MODIFIER_MASK = 0x5f001fff
} IBustModifierType;

/**
 * IBustCapabilite:
 * @IBUST_CAP_PREEDIT_TEXT: UI is capable to show pre-edit text.
 * @IBUST_CAP_AUXILIARY_TEXT: UI is capable to show auxiliary text.
 * @IBUST_CAP_LOOKUP_TABLE: UI is capable to show the lookup table.
 * @IBUST_CAP_FOCUS: UI is capable to get focus.
 * @IBUST_CAP_PROPERTY: UI is capable to have property.
 * @IBUST_CAP_SURROUNDING_TEXT: Client can provide surround text,
 *  or IME can handle surround text.
 *
 * Capability flags of UI.
 */
typedef enum {
    IBUST_CAP_PREEDIT_TEXT       = 1 << 0,
    IBUST_CAP_AUXILIARY_TEXT     = 1 << 1,
    IBUST_CAP_LOOKUP_TABLE       = 1 << 2,
    IBUST_CAP_FOCUS              = 1 << 3,
    IBUST_CAP_PROPERTY           = 1 << 4,
    IBUST_CAP_SURROUNDING_TEXT   = 1 << 5,
} IBustCapabilite;

/**
 * IBustPreeditFocusMode:
 * @IBUST_ENGINE_PREEDIT_CLEAR: pre-edit text is cleared.
 * @IBUST_ENGINE_PREEDIT_COMMIT: pre-edit text is committed.
 *
 * Pre-edit commit mode when the focus is lost.
 */
typedef enum {
    IBUST_ENGINE_PREEDIT_CLEAR   = 0,
    IBUST_ENGINE_PREEDIT_COMMIT  = 1,
} IBustPreeditFocusMode;

/**
 * IBustOrientation:
 * @IBUST_ORIENTATION_HORIZONTAL: Horizontal orientation.
 * @IBUST_ORIENTATION_VERTICAL: Vertival orientation.
 * @IBUST_ORIENTATION_SYSTEM: Use ibust global orientation setup.
 *
 * Orientation of UI.
 */
typedef enum {
    IBUST_ORIENTATION_HORIZONTAL = 0,
    IBUST_ORIENTATION_VERTICAL   = 1,
    IBUST_ORIENTATION_SYSTEM     = 2,
} IBustOrientation;

/**
 * IBustBusNameFlag:
 * @IBUST_BUS_NAME_FLAG_ALLOW_REPLACEMENT:
 *    same as DBUS_NAME_FLAG_ALLOW_REPLACEMENT	
 * @IBUST_BUS_NAME_FLAG_REPLACE_EXISTING:
 *    same as DBUS_NAME_FLAG_REPLACE_EXISTING
 * @IBUST_BUS_NAME_FLAG_DO_NOT_QUEUE:
 *    same as DBUS_NAME_FLAG_DO_NOT_QUEUE 
 */
typedef enum {
    IBUST_BUS_NAME_FLAG_ALLOW_REPLACEMENT   = (1 << 0),
    IBUST_BUS_NAME_FLAG_REPLACE_EXISTING    = (1 << 1),
    IBUST_BUS_NAME_FLAG_DO_NOT_QUEUE        = (1 << 2),
} IBustBusNameFlag;

/**
 * IBustBusRequestNameReply:
 * @IBUST_BUS_REQUEST_NAME_REPLY_PRIMARY_OWNER:
 *    same as DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER
 * @IBUST_BUS_REQUEST_NAME_REPLY_IN_QUEUE:
 *    same as DBUS_REQUEST_NAME_REPLY_IN_QUEUE
 * @IBUST_BUS_REQUEST_NAME_REPLY_EXISTS:
 *    same as DBUS_REQUEST_NAME_REPLY_EXISTS
 * @IBUST_BUS_REQUEST_NAME_REPLY_ALREADY_OWNER:
 *    same as DBUS_REQUEST_NAME_REPLY_ALREADY_OWNER
 */
typedef enum {
    IBUST_BUS_REQUEST_NAME_REPLY_PRIMARY_OWNER   = 1,
    IBUST_BUS_REQUEST_NAME_REPLY_IN_QUEUE        = 2,
    IBUST_BUS_REQUEST_NAME_REPLY_EXISTS          = 3,
    IBUST_BUS_REQUEST_NAME_REPLY_ALREADY_OWNER   = 4,
} IBustBusRequestNameReply;

/**
 * IBustBusStartServiceByNameReply:
 * @IBUST_BUS_START_REPLY_SUCCESS:
 *    same as DBUS_START_REPLY_SUCCESS
 * @IBUST_BUS_START_REPLY_ALREADY_RUNNING:
 *    same as DBUS_START_REPLY_ALREADY_RUNNING
 */
typedef enum {
    IBUST_BUS_START_REPLY_SUCCESS = 1,
    IBUST_BUS_START_REPLY_ALREADY_RUNNING = 2,
} IBustBusStartServiceByNameReply;

/**
 * IBustError:
 * @IBUST_ERROR_NO_ENGINE:
 * There is no engine associated with input context.
 * @IBUST_ERROR_NO_CONFIG:
 * There is no config module running.
 * @IBUST_ERROR_FAILED:
 * General failure.
 */
typedef enum {
    IBUST_ERROR_NO_ENGINE,
    IBUST_ERROR_NO_CONFIG,
    IBUST_ERROR_FAILED
} IBustError;

/**
 * IBustRectangle:
 * @x: x coordinate.
 * @y: y coordinate.
 * @width: width of the rectangle.
 * @height: height of the renctangl.
 *
 * Rectangle definition.
 */
typedef struct _IBustRectangle IBustRectangle;
struct _IBustRectangle {
    gint x;
    gint y;
    gint width;
    gint height;
};

/**
 * IBustFreeFunc:
 * @object: object to be freed.
 *
 * Free function prototype.
 */
typedef void (* IBustFreeFunc) (gpointer object);

#endif

